<template>
	<view :style="{'background-color':dataobj.editable?'#f8f8f8':'#fff'}" style="padding: 8px 18px;color:#aaa;font-size: 14px; display: flex;flex-direction: row;justify-content: space-between;">
		
		<view style="display: flex;align-items: center;color: #666;" :style="{'fontSize':clientType=='pda'?'20px':'14px'}">{{dataobj.colText}} 
			<view v-if="dataobj.tag_isNotEmpty" style="color: #F55C23;font-size: 6px;" class="iconfont icon-jiufuqianbaoicon14"> </view>
		</view>
		<view style="text-align: right;width: 60vw;" :style="{'fontSize':clientType=='pda'?'20px':'14px'}">
			<switch type="checkbox" :checked='dataobj.checkbox.on == dataobj.value' :disabled="!((dataobj.tabsequence!=0) && (!dataobj.protect)) && !isaddedit" @change="switchChange"/>
		</view>
	</view>
</template>


<script>
	export default {
		props:{
			dataobj:{
				type:Object
			},
			listitemindex:{
				type:Number
			},
			listindex:{
				type:Number
			},
			listblockindex:{
				type:Number
			},
			jsonoptions:{
				type:Object
			},
			divArea:{
				type:String
			},
			pagename:{
				type:String
			},
			isaddedit:{
				type:Boolean
			},
			property:{
				type:Object
			},
			clientType:{
				type:String,
				default(){
					return ""
				}
			}
		},
		
		mounted:function(res){
		},
		
		methods:{
			switchChange(e){
				var that = this
				var switchcheck = e.detail.value
				if(switchcheck){
					that.dataobj.value = that.dataobj.checkbox.on
					that.dataobj.colValue = that.dataobj.checkbox.on
					that.dataobj.coldisplay = that.dataobj.checkbox.on
				}else{
					that.dataobj.value = that.dataobj.checkbox.off
					that.dataobj.colValue = that.dataobj.checkbox.off
					that.dataobj.coldisplay = that.dataobj.checkbox.off
				}
				that.dataobj.ismodified = true
				uni.$emit("updatelist", that.divArea, that.listindex, that.listblockindex, that.listitemindex, that.dataobj,this.pagename)
			},
			
		}
	}
</script>

<style>
</style>
